﻿package com.tiankong.android.wallpaper;

import com.tiankong.android.wallpaper.draw.Drawer;

import android.os.Handler;
import android.os.Message;

public class LoopDrowHandler extends Handler {
	private final int DRAW = 1;
	public Drawer drawer = null;

	public void handleMessage(Message msg) {
		switch (msg.what) {
		case DRAW:
			startDraw(drawer);
			break;
		}
	}

	public void startDraw(Drawer drawer) {
		// 开始绘画
		this.removeMessages(DRAW);
		if (drawer != null)
		{
			this.drawer = drawer;
			if (drawer.drawWall()) {
				this.sendEmptyMessageDelayed(DRAW, 1000);
			}
		}
	}

	public void stopDraw() {
		// 停止绘画
		this.removeMessages(DRAW);
	}

}
